home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / orgz.lha / Orgz.rexx < prev    next >
OS/2 REXX Batch file  |  1996-04-07  |  11KB  |  330 lines

  1.  
  2. /*
  3.  
  4. Shows a list of all CNet-BBS callers' "organization" strings.
  5.  
  6. Find out who's who.
  7.  
  8. Are callers even using organization-strings?  What percent are?
  9.  
  10. > Users of Amiga ShareWare HQ, 810-473-2020, 1:2410/207, as of 05-Apr-96 ...
  11. >
  12. > ID## === HANDLE ===      === REAL-NAME ===      === ORGANIZATION ===
  13. >    1 SysOp               Bill Beogelein         CNet-BBS V3.05 Tester
  14. >    6 Bern                Bernhard Muller        MACRO
  15. >   12 Jim Harvey          (=)                    MACRO
  16. >   13 Jurgen              Jurgen Switalski       Macro
  17. >   14 Jim Selleck         (=)                    Perspective Software
  18. >   17 Boomer              Mike Wrobel            Cnet Amiga
  19. >  285 Kristen Thorsen     (=)                    Colosseum BBS
  20. >  287 Jim Krzyzak         [PRIVATE]              Crystal Cave BBS
  21. >  295 Michael Painter     (=)                    TeleCable Targeting
  22. >  296 Jack Patton         [PRIVATE]              CyberSphere BBS
  23. > ID## === HANDLE ===      === REAL-NAME ===      === ORGANIZATION ===
  24. >
  25. >  435 out of 1464 users have organization-strings. (29%)
  26.  
  27. Shows handles, real-names (if NOT private), and organization strings.
  28.  
  29. Runs from the CLI, or online.
  30.  
  31. ===================================================================
  32.  
  33. Pick installation method #1 or #2.  (You do NOT need to do both.)
  34.  
  35. Installation Method #1:   (Allows for real-time computing, but is slow.)
  36.    A) Edit the variables below marked as "SysOp Variables".
  37.  
  38.    B) Copy Orgz.rexx TO CNet:Rexx/Orgz.rexx
  39.  
  40.    C) Edit your CNet:BBSmenu file.
  41.       Onto the END of the list marked "2; Available everywhere",
  42.       add the following line...
  43.       > ORGanizations, ORGz | #4 rx CNet:Rexx/Orgz.rexx MIN=1 SORT=6}
  44.  
  45.  
  46. Installation Method #2:    (Allows for very fast, online execution.)
  47.    A) Edit the variables below marked as "SysOp Variables".
  48.  
  49.    B) Copy Orgz.rexx TO CNet:Rexx/Orgz.rexx
  50.  
  51.    C) Edit your CNet:BBSmenu file.
  52.       Onto the END of the list marked "2; Available everywhere",
  53.       add the following line...
  54.       > ORGanizations, ORGz | {*1 SysText:Orgz.txt}
  55.  
  56.    D) Set-up a nightly CNet event as:
  57.       Ports   : 0
  58.       Weekdays: SMTWRFS
  59.       Time    : 100
  60.       Valid   : 1
  61.       Interval: 0
  62.       Iterate : 1
  63.       Type    : Immediate--system idle or not
  64.       Command : DOS-CMD
  65.       Args    : rx CNet:Rexx/Orgz.rexx >SysText:Orgz.txt MIN=1 SORT=6
  66.  
  67. ===================================================================
  68.  
  69. Orgz.rexx allows any of the following options, in any order.
  70.       MIN=n     : Start at acct #n.  (Use MIN=2 if you wish to skip SysOp acct #1)
  71.                   ("MIN=?" will prompt user for acct #)
  72.       MAX=n     : End at acct #n.
  73.                   ("MAX=?" will prompt user for acct #)
  74.       NOHANDLES : Do NOT show handles.
  75.       PRIVATE   : Show real-names, even if 'private'.
  76.       SMART     : If real-name is 'public', show it.  Otherwise, show handle.
  77.       ALL       : List all users (even those w/o organization)
  78.       SORT=6    : Sort the output by handle.
  79.       SORT=26   : Sort the output by real-name.
  80.       SORT=49   : Sort the output by organization.
  81.       SORT=7    : Sort the output by name. (If using NOHANDLES or SMART option)
  82.       SORT=30   : Sort the output by organization. (If using NOHANDLES or SMART)
  83.       HELP      : Display this help-text.
  84.  
  85. (No one other than the SysOp should ever view a list using the "PRIVATE" option.)
  86.  
  87. =============================================================
  88.  
  89. Perhaps someone will volunteer to gather together a bunch of
  90. orgz-lists for various BBS.  Kind of a global "Who's Who".  Placing
  91. them all into one archive.  (Perhaps renaming each individual list
  92. into that BBS's phone number.)  My orgz-list is updated automatically
  93. each week.  You can File-Requ it as "ORGLIST" from 1:2410/207 at any
  94. time.
  95.  
  96. $VER: Orgz.rexx 1.0 (7.4.96) 07-Apr-96
  97.    Fixed version-string date.
  98.    Released in aminet.
  99.  
  100. $VER: Orgz.rexx v0.2 Wednesday 14-Sep-94 00:48:59
  101.    Added SORT=n options.
  102.    Added ALL option.
  103.  
  104. $VER: Orgz.rexx v0.1 Tue 13-Sep-94 05:56:35
  105.    Written and tested with CNet-BBS v3.05c
  106.  
  107. Future plans:
  108.    Add BANNER option to display who-banners instead of org-strings.
  109.    Rename BB's list to "810-473-2020" filename.
  110.    U/L to "Werner Csanitz@1:2606/543" for testing.
  111.    Please report all bugs and suggestions.
  112.  
  113. Author Info:
  114.    Bill Beogelein
  115.    Box 530441
  116.    Livonia, MI 48153
  117.    BBS 1-810-473-2020 (Note: Areacode changed from 313 to 810)
  118.    Fido 1:2410/207
  119.  
  120. Ignore:
  121.    lz u CNet3:Orgz.LHA CNet:Rexx/Orgz.rexx HELP:BB_CMDS a:zzzBBS SysText:Orgz.txt
  122.  
  123. *** End of Orgz.doc ***/
  124.  
  125. /**************** Top of SysOp Variables List *******************/
  126.  
  127. pri   = -1                  /* Task priority to run at          */
  128. fname = "SysData:bbs.udata" /* Path/name of your user-data file */
  129.  
  130.                             /* A note about your BBS.... */
  131. note  = "Users of Amiga ShareWare HQ, 810-473-2020, 1:2410/207"
  132.                             /* ...the current date is automatically appended */
  133.  
  134. /**************** End of SysOp Variables List *******************/
  135.  
  136. call pragma('PRIORITY', pri)
  137. options results
  138. parse arg opts
  139.  
  140. LF   = '0a'x
  141. YES  = (1==1)
  142. NO   = (1==0)
  143.  
  144. if( opts="" ) then call HelpExit()
  145.  
  146. o_nohand = GetSwitch(opts, "NOHANDLES", NO)
  147. o_private= GetSwitch(opts, "PRIVATE"  , NO)
  148. o_help   = GetSwitch(opts, "HELP"     , NO)
  149. o_smart  = GetSwitch(opts, "SMART"    , NO)
  150. o_all    = GetSwitch(opts, "ALL"      , NO)
  151. /* o_banners= GetSwitch(opts, "BANNERS"  , NO) */
  152.  
  153. o_sort   = GetArg(opts, "SORT=",     0)    /* Sort on which column? */
  154. o_min    = GetArg(opts, "MIN=" ,     1)    /* MIN=1     */
  155. o_max    = GetArg(opts, "MAX=" , 65555)    /* MAX=65555 */
  156.  
  157. if( o_smart  ) then o_nohand = YES
  158.  
  159. form  = "ID## === HANDLE ===      === REAL-NAME ===      === ORGANIZATION ==="
  160. if( o_nohand ) then form = "ID##  === NAME ===           === ORGANIZATION ==="
  161.  
  162. if( o_min="?" ) then
  163. do
  164.    call writeCH(STDOUT, LF "Enter starting acct #: ")
  165.    o_min = readLN(STDIN)
  166. end
  167.  
  168. if( o_max="?" ) then
  169. do
  170.    call writeCH(STDOUT, LF "Enter ending acct #  : ")
  171.    o_max = readLN(STDIN)
  172. end
  173.  
  174. if( o_min<1 | o_min="" ) then o_min=1             /* Default is all (1-65555) */
  175. if( o_max<1 | o_max="" ) then o_max=65555
  176.  
  177. if( o_help | o_min>o_max ) then call HelpExit()    /* and exit */
  178.  
  179. if( opts~="" ) then
  180. do
  181.    say LF || "*** Orgz.rexx illegal options: " opts
  182.    call HelpExit()
  183. end
  184.  
  185. size = 672           /* Do NOT edit (Size of 1 user-data record) */
  186. big  = 999999999     /* Arbitrary big # */
  187.  
  188. if( ~open(fp, fname, 'READ') ) then
  189. do
  190.    say LF "*** Can't open" fname "for reading." LF
  191.    exit
  192. end
  193.  
  194. call seek(fp, (o_min-1)*size, 'BEGINNING')     /* Skip these users */
  195.  
  196. tmpFile1 = "t:Orgz." || pragma('ID') || ".1.tmp"
  197. tmpFile2 = "t:Orgz." || pragma('ID') || ".2.tmp"
  198. if( o_sort>0 ) then
  199.    call open(tmpfp, tmpFile1, 'WRITE')
  200. else
  201.    call TopText()
  202.  
  203. has_orgz = 0; display=0
  204. do users=o_min to o_max
  205.    buf  = readCH(fp, size)          /* Read each user's full data in 1 pass */
  206.  
  207.    if( eof(fp) ) then leave
  208.  
  209. /* 9997 SysOp     (=)                SysOp of 810-473-2020    Public and same      */
  210. /* 9998 SysOp                        SysOp of 810-473-2020    Private              */
  211. /* 9999 SysOp     Bill Beogelein     SysOp of 810-473-2020    Public and different */
  212.  
  213.    hand = Chop(substr(buf,   5, 21))    /* char Handle[21]  ;   4 i:CNet/CNet.h */
  214.    name = Chop(substr(buf,  26, 26))    /* char RealName[26];  25 */
  215.    priv =  c2d(substr(buf, 490,  1))    /* UBYTE private    ; 489 */
  216.  
  217. /***
  218.    if( o_banners ) then
  219.       orgz = Chop(substr(buf, 495, 43))    /* char Banner[43]  ; 494 */
  220.    else
  221. ***/
  222.       orgz = Chop(substr(buf, 307, 31))    /* char Organiz[31] ; 306 */
  223.  
  224.    if( orgz~=""                      ) then has_orgz = has_orgz+1
  225.  
  226.    if( hand == "!"                   ) then hand = "[DELETED]"
  227.    if( priv=YES & o_private==NO      ) then name = "[PRIVATE]"
  228.    if( (name == hand) & o_nohand==NO ) then name = "(=)"
  229.    if( o_smart & priv==YES           ) then name = hand
  230.    if( o_all & orgz == ""            ) then orgz = "[NONE]"
  231.  
  232.    hand = left(hand,19)
  233.    name = left(name,22)
  234.  
  235.    if( o_nohand ) then hand=""
  236.  
  237.    if( orgz ~= "" ) then
  238.    do
  239.       display = display+1
  240.       if( o_sort>0 ) then
  241.          call writeLN(tmpfp, right(users,4) hand name orgz)
  242.      else
  243.          say right(users,4) hand name orgz
  244.    end
  245. end
  246. call close(fp)
  247. users=users-o_min
  248. if( o_sort>0 ) then
  249. do
  250.    call close(tmpfp)
  251.    call TopText()
  252.    address command "Sort" tmpFile1 tmpFile2 "COLSTART" o_sort
  253.    call ShowFile(tmpFile2)
  254.    address command "Delete QUIET" tmpFile1 tmpFile2
  255. end
  256. call BotText()
  257.  
  258. exit     /************* End ****************/
  259.  
  260. DateForm:   PROCEDURE      /* Show the current date as "Wed, 22-Jun-94" */
  261.    a2=date('NORMAL')                        /* 01 Jan 1990 */
  262.    a2=delstr(a2, 8, 2)                      /* 01 Jan 90   */
  263. return translate(a2, "-", " ")              /* 01-Jan-90   */
  264.  
  265. Chop:  PROCEDURE                            /* Chop string var to 1st \0 */
  266.    parse arg str
  267.    p=index(str, '0'x)
  268.    if(p>0) then p=p-1
  269. return left(str, p)
  270.  
  271. GetSwitch:  PROCEDURE   EXPOSE opts  /* o_reset = GetSwitch(opts, "RESET", 0) */
  272.    parse arg opts, str, def
  273.    w=find(upper(opts), upper(str))
  274.    if(w<1) then return def
  275.    opts=delword(opts, w, 1)
  276. return ~(def)        /*** End of GetSwitch ***/
  277.  
  278. GetArg:     PROCEDURE   EXPOSE opts    /* min = GetArg(opts, "MIN=", 10) */
  279.    parse arg opts, str, def
  280.    p=pos(upper(str), upper(opts))
  281.    if(p<1) then return def
  282.    len=length(str)
  283.    s=word(substr(opts, p+len),1)
  284.    opts=delstr(opts, p, len+length(s)+1)
  285. return s             /*** End of GetArg ***/
  286.  
  287. TopText:
  288.    say LF "                     'Orgz' by Bill Beogelein" LF
  289.    say note || ", as of" DateForm() "..." LF LF || form
  290. return
  291.  
  292. BotText:
  293.    if( display>15 ) then say form
  294.    avg = trunc(has_orgz*100/users)
  295.    say LF has_orgz "out of" users "users have organization-strings. (" || avg || "%)"
  296. return
  297.  
  298. ShowFile:   PROCEDURE      /* Load and display this file */
  299.    parse arg fname
  300.    if(open(fp, fname, 'READ')) then
  301.    do
  302.       do forever
  303.          buf = readLN(fp)
  304.          if( eof(fp) ) then leave
  305.          say buf
  306.       end
  307.       call close(fp)
  308.    end
  309.       else say "*** Can't open" fname "for reading."
  310. return   /*** End of ShowFile ***/
  311.  
  312. HelpExit:
  313.    say LF "'Orgz' by Bill Beogelein" LF
  314.    say "MIN=n     : Start at acct #n.  (Use MIN=2 if you wish to skip SysOp acct #1.)"
  315.    say "MAX=n     : End at acct #n.    (MIN=? or MAX=? will prompt user.)"
  316.    say "NOHANDLES : Do NOT show handles."
  317.    say "PRIVATE   : Show real-names, even if 'private'."
  318.    say "SMART     : If real-name is 'public', show it.  Otherwise, show handle."
  319.    say "ALL       : List all users (even those w/o organization)"
  320.    say "SORT=6    : Sort the output by handle."
  321.    say "SORT=26   : Sort the output by real-name."
  322.    say "SORT=49   : Sort the output by organization."
  323.    say "SORT=7    : Sort the output by name. (If using NOHANDLES or SMART option)"
  324.    say "SORT=30   : Sort the output by organization. (If using NOHANDLES or SMART)"
  325.    say "HELP      : Display this help-text."
  326.    exit
  327. return
  328.  
  329. /*** EOF CNet:Rexx/Orgz.rexx 810-473-2020 ***/
  330.